
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    {$LOAD_STYLE.top|raw}
</head>
<body class="pear-container">
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <form class="layui-form edit-form" method="post" action="">
            <div class="layui-tab layui-tab-brief" lay-filter="TabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">调试设置</li>
					<li>数据库配置</li>
					<li>域名映射</li>
					<li>路径设置</li>
					<li>上传配置</li>
					<li>大模型配置</li>
                </ul>
                <div class="layui-tab-content">
					<div class="layui-tab-item layui-show">
						<div class="layui-form-item">
							<label class="layui-form-label">
								调试状态：
							</label>
							<div class="layui-input-block">
								{:lay_switch('app_debug',$data['APP_DEBUG'],'开启|关闭')}
							</div>
							<div class="layui-form-mid layui-word-aux">开启后，页面错误明细将会全部显示，并且同事开启Trace调试</div>
						</div>
						<div class="layui-form-item">
						    <label class="layui-form-label">
						        Trace显示
						    </label>
						    <div class="layui-input-block">
						        {if $data['TRACE_TYPE'] == 'Html'}
						            <input type="radio" name="trace[type]" value="Html" title="Html" checked>
						            <input type="radio" name="trace[type]" value="Console" title="Console">
						        {else}
						            <input type="radio" name="trace[type]" value="Html" title="Html">
						            <input type="radio" name="trace[type]" value="Console" title="Console" checked>
						        {/if}
						    </div>
							<div class="layui-form-mid layui-word-aux">Html 方便查看，但是可能会影响ajax的输出</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								后台日志：
							</label>
							<div class="layui-input-block">
								{:lay_switch('log[admin_record]',$data['LOG_ADMIN_RECORD'],'开启|关闭')}
							</div>
							<div class="layui-form-mid layui-word-aux">开启后，后台操作日志会自动写入数据库</div>
						</div>
						<div class="layui-form-item">
						    <label class="layui-form-label">
						        登录验证码
						    </label>
						    <div class="layui-input-block">
						        {if $data['trace']['login_captcha']??0 == 1}
						            <input type="radio" name="trace[login_captcha]" value="1" title="开启" checked>
						            <input type="radio" name="trace[login_captcha]" value="0" title="关闭">
						        {else}
						            <input type="radio" name="trace[login_captcha]" value="1" title="开启">
						            <input type="radio" name="trace[login_captcha]" value="0" title="关闭" checked>
						        {/if}
						    </div>
						</div>
					</div>
					<div class="layui-tab-item ">
						<div class="layui-form-item">
							<label class="layui-form-label">
								类型：
							</label>
							<div class="layui-input-block">
								<input autocomplete="off" class="layui-input" name="database[type]" value="{$data['DATABASE_TYPE']??'mysql'}" type="text"/>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								主机名：
							</label>
							<div class="layui-input-block">
								<input autocomplete="off" class="layui-input" name="database[hostname]" value="{$data['DATABASE_HOSTNAME']??''}" type="text"/>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								数据库名：
							</label>
							<div class="layui-input-block">
								<input autocomplete="off" class="layui-input" name="database[database]" value="{$data['DATABASE_DATABASE']??''}" type="text"/>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								账号：
							</label>
							<div class="layui-input-block">
								<input autocomplete="off" class="layui-input" name="database[username]" value="{$data['DATABASE_USERNAME']??''}" type="text"/>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								密码：
							</label>
							<div class="layui-input-block">
								<input autocomplete="off" class="layui-input" name="database[password]" value="{$data['DATABASE_PASSWORD']??''}" type="text"/>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								端口：
							</label>
							<div class="layui-input-block">
								<input autocomplete="off" class="layui-input" name="database[hostport]" value="{$data['DATABASE_HOSTPORT']??'3306'}" type="text"/>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								表前缀：
							</label>
							<div class="layui-input-block">
								<input autocomplete="off" class="layui-input" name="database[prefix]" value="{$data['DATABASE_PREFIX']??''}" type="text"/>
							</div>
						</div>
					</div>
					<div class="layui-tab-item ">
						<div class="layui-form-item">
							<div class="layui-form-item">
								<label class="layui-form-label">
									域名映射：
								</label>
								<div class="layui-input-block">
									{:lay_switch('route[domains]',$data['ROUTE_DOMAINS'],'开启|关闭')}
								</div>
								<div class="layui-form-mid layui-word-aux">开启后，不同域名会指向不同模块独立访问</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									首页：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="route[domain_home]" value="{$data['ROUTE_DOMAIN_HOME']??''}" type="text"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									后台：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="route[domain_admin]" value="{$data['ROUTE_DOMAIN_ADMIN']??''}" type="text"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									手机端：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="route[domain_wap]" value="{$data['ROUTE_DOMAIN_WAP']??''}" type="text"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									Api：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="route[domain_api]" value="{$data['ROUTE_DOMAIN_API']??''}" type="text"/>
								</div>
							</div>
						</div>
					</div>
					<div class="layui-tab-item ">
						<div class="layui-form-item">
							<div class="layui-form-item">
								<label class="layui-form-label">
									CSS路径：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="path[css_path]" value="{$data['PATH_CSS_PATH']??''}" type="text" placeholder="css_path"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									JS路径：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="path[js_path]" value="{$data['PATH_JS_PATH']??''}" type="text" placeholder="js_path"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									图片路径：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="path[images_path]" value="{$data['PATH_IMAGES_PATH']??''}" type="text" placeholder="images_path"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									扩展工具路径：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="path[tool_path]" value="{$data['PATH_TOOL_PATH']??''}" type="text" placeholder="tool_path"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">
									框架组件路径：
								</label>
								<div class="layui-input-block">
									<input autocomplete="off" class="layui-input" name="path[component_path]" value="{$data['PATH_COMPONENT_PATH']??''}" type="text" placeholder="component_path"/>
								</div>
							</div>
						</div>
					</div>
					
					<div class="layui-tab-item">
						<div class="layui-form-item">
							<label class="layui-form-label">
								图片压缩：
							</label>
							<div class="layui-input-block">
								{:lay_switch('upload[image_zip]',$data['UPLOAD_IMAGE_ZIP'],'开启|关闭')}
							</div>
							<div class="layui-form-mid layui-word-aux">开启后，上传到本地的图片将会自动压缩 压缩率70%</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">
								图片宽度上限：
							</label>
							<div class="layui-input-block">
								<input type="number" autocomplete="off" class="layui-input" name="upload[image_max_width]" value="{$data['UPLOAD_IMAGE_MAX_WIDTH']??'1024'}" placeholder="请输入图片最高宽度尺寸,不填默认1024" type="text"/>
								<div class="layui-form-mid layui-word-aux">上传图片超过上限，会自动压缩该宽度尺寸，高度等宽。不超过尺寸压缩质量，需开启图片压缩才生效</div>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">存储方式</label>
							<div class="layui-input-block">
							<input type="radio" name="upload[file_type]" value="1" title="本地" {if condition="$data['UPLOAD_FILE_TYPE'] eq 1"} checked {/if} lay-filter="filetype">
							<input type="radio" name="upload[file_type]" value="2" title="阿里云" {if condition="$data['UPLOAD_FILE_TYPE'] eq 2"} checked {/if} lay-filter="filetype">
							<input type="radio" name="upload[file_type]" value="3" title="七牛云" {if condition="$data['UPLOAD_FILE_TYPE'] eq 3"} checked {/if} lay-filter="filetype">
							</div>
						</div>
						<div class="layui-form-item" id="oss" {if condition="$data['UPLOAD_FILE_TYPE'] neq 2"} style="display: none;" {/if}>
							<div class="layui-form-item">
								<label class="layui-form-label">Oss地址</label>
								<div class="layui-input-block">
									<input type="text" name="upload[file_endpoint]"  value="{$data['UPLOAD_FILE_ENDPOINT']??''}"  placeholder="请输入Oss地址" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">空间名称</label>
								<div class="layui-input-block">
									<input type="text" name="upload[file_OssName]"   value="{$data['UPLOAD_FILE_OSSNAME']??''}" placeholder="请输入空间名称" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">KeyId</label>
								<div class="layui-input-block">
									<input type="text" name="upload[file_accessKeyId]"   value="{$data['UPLOAD_FILE_ACCESSKEYID']??''}" placeholder="请输入KeyId" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">KeySecret</label>
								<div class="layui-input-block">
									<input type="text" name="upload[file_accessKeySecret]"   value="{$data['UPLOAD_FILE_ACCESSKEYSECRET']??''}"  placeholder="请输入KeySecret" autocomplete="off" class="layui-input">
								</div>
							</div>
						</div>
						
						<div class="layui-form-item" id="qiniu" {if condition="$data['UPLOAD_FILE_TYPE'] neq 3"} style="display: none;" {/if}>
							<div class="layui-form-item">
								<label class="layui-form-label">空间域名</label>
								<div class="layui-input-block">
									<input type="text" name="upload[qiniu_Domain]" value="{$data['UPLOAD_QINIU_DOMAIN']??''}"  placeholder="请输入绑定空间域名" autocomplete="off" class="layui-input">
									<div class="layui-form-mid layui-word-aux">开头请不要加 http:// 或者 https://</div>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">BUCKET</label>
								<div class="layui-input-block">
									<input type="text" name="upload[qiniu_Bucket]" value="{$data['UPLOAD_QINIU_BUCKET']??''}" placeholder="请输入空间BUCKET" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">AK</label>
								<div class="layui-input-block">
									<input type="text" name="upload[qiniu_AK]" value="{$data['UPLOAD_QINIU_AK']??''}" placeholder="请输入AK" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">SK</label>
								<div class="layui-input-block">
									<input type="text" name="upload[qiniu_SK]" value="{$data['UPLOAD_QINIU_SK']??''}"  placeholder="请输入SK" autocomplete="off" class="layui-input">
								</div>
							</div>
						</div>
					</div>
					
					<div class="layui-tab-item">
						
						<div class="layui-form-item">
							<label class="layui-form-label">大模型</label>
							<div class="layui-input-block">
                            <input type="radio" name="ai[ai_name]" value="siliconflow" title="硅基流动" {if condition="$data['AI_AI_NAME'] eq 'siliconflow'"} checked {/if} lay-filter="aitype">
							<input type="radio" name="ai[ai_name]" value="glm" title="GLM" {if condition="$data['AI_AI_NAME'] eq 'glm'"} checked {/if} lay-filter="aitype">
							<input type="radio" name="ai[ai_name]" value="deepseek" title="DeepSeek" {if condition="$data['AI_AI_NAME'] eq 'deepseek'"} checked {/if} lay-filter="aitype">
							<input type="radio" name="ai[ai_name]" value="hunyuan" title="腾讯混元" {if condition="$data['AI_AI_NAME'] eq 'hunyuan'"} checked {/if} lay-filter="aitype">
							<input type="radio" name="ai[ai_name]" value="other" title="其他" {if condition="$data['AI_AI_NAME'] eq 'other'"} checked {/if} lay-filter="aitype">
							</div>
						</div>
                        
                        <div class="layui-form-item ai-item" id="siliconflow" {if condition="$data['AI_AI_NAME'] neq 'siliconflow'"} style="display: none;" {/if}>
                            <div class="layui-form-item">
                                <label class="layui-form-label">模型版本</label>
                                <div class="layui-input-block">
                                    <select name="ai[siliconflow_model]" lay-verify="required" verify="must">
                                        <option value="deepseek-ai/DeepSeek-R1" {if condition="$data['AI_SILICONFLOW_MODEL'] eq 'deepseek-ai/DeepSeek-R1'"} selected="selected" {/if}>DeepSeek-R1（基础版）</option>
                                        <option value="deepseek-ai/DeepSeek-V3" {if condition="$data['AI_SILICONFLOW_MODEL'] eq 'deepseek-ai/DeepSeek-V3'"} selected="selected" {/if}>DeepSeek-V3（多模态版）</option>
                                        <option value="deepseek-ai/DeepSeek-R1-Distill-Qwen-7B" {if condition="$data['AI_SILICONFLOW_MODEL'] eq 'deepseek-ai/DeepSeek-R1-Distill-Qwen-7B'"} selected="selected" {/if}>DeepSeek 7B（免费版）</option>
                                        <option value="Qwen/Qwen2.5-Coder-7B-Instruct" {if condition="$data['AI_SILICONFLOW_MODEL'] eq 'Qwen/Qwen2.5-Coder-7B-Instruct'"} selected="selected" {/if}>通义千问 7B（免费版）</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">API密钥</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ai[siliconflow_key]" value="{$data['AI_SILICONFLOW_KEY']??''}" 
                                           placeholder="请输入安全密钥" autocomplete="new-password" class="layui-input">
                                    <div class="layui-form-mid layui-word-aux">
                                        该接口对接硅基流动开放平台，密钥需包含组织ID（格式：org-xxx_sk-xxx）
                                        密钥管理请访问 <a href="https://cloud.siliconflow.cn/account/ak" target="_blank" style="color:#1E9FFF">硅基控制台</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
						<div class="layui-form-item ai-item" id="glm" {if condition="$data['AI_AI_NAME'] neq 'glm'"} style="display: none;" {/if}>
							<div class="layui-form-item">
								<label class="layui-form-label">模型版本</label>
								<div class="layui-input-block">
									<select name="ai[glm_model]" lay-verify="required" verify="must"'>
										<option value="glm-4-flash" {if condition="$data['AI_GLM_MODEL'] eq 'glm-4-flash'"} selected="selected" {/if}>GLM-4-Flash(免费)</option>
										<option value="glm-4-flashx" {if condition="$data['AI_GLM_MODEL'] eq 'glm-4-flashx'"} selected="selected" {/if}>GLM-4-FlashX</option>
										<option value="glm-4-airx" {if condition="$data['AI_GLM_MODEL'] eq 'glm-4-airx'"} selected="selected" {/if}>GLM-4-AirX</option>
									</select>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">模型KEY</label>
								<div class="layui-input-block">
									<input type="text" name="ai[glm_key]"  value="{$data['AI_GLM_KEY']??''}"  placeholder="请输入模型key" autocomplete="off" class="layui-input">
									<div class="layui-form-mid layui-word-aux">
									    此接口为智普大模型官方接口，需要输入授权的访问 Key。
									    了解详情，请访问 <a href="https://bigmodel.cn/usercenter/proj-mgmt/apikeys" target="_blank">【智谱清言】</a>
									</div>
								</div>
							</div>
						</div>
						
						<div class="layui-form-item ai-item" id="deepseek" {if condition="$data['AI_AI_NAME'] neq 'deepseek'"} style="display: none;" {/if}>
							<div class="layui-form-item">
								<label class="layui-form-label">模型KEY</label>
								<div class="layui-input-block">
									<input type="text" name="ai[deepseek_key]"  value="{$data['AI_DEEPSEEK_KEY']??''}"  placeholder="请输入模型key" autocomplete="off" class="layui-input">
									<div class="layui-form-mid layui-word-aux">
										该接口为第三方官方收费接口，申请KEY请点
										<a href="https://platform.deepseek.com/api_keys" target="_blank">【KEY申请】</a>
										如需充值，请点击按钮前往官方充值
										<a href="https://platform.deepseek.com/top_up" target="_blank">【充值接口】</a>
									</div>
								</div>
							</div>
						</div>
						
						<div class="layui-form-item ai-item" id="hunyuan" {if condition="$data['AI_AI_NAME'] neq 'hunyuan'"} style="display: none;" {/if}>
						    <div class="layui-form-item">
						        <label class="layui-form-label">模型版本</label>
						        <div class="layui-input-block">
						            <select name="ai[hunyuan_model]" lay-verify="required" verify="must">
						                <option value="hunyuan-lite" {if condition="$data['AI_HUNYUAN_MODEL'] eq 'hunyuan-lite'"} selected="selected" {/if}>Hunyuan-Lite(免费)</option>
						            </select>
						        </div>
						    </div>
						    <div class="layui-form-item">
						        <label class="layui-form-label">模型KEY</label>
						        <div class="layui-input-block">
						            <input type="text" name="ai[hunyuan_key]" value="{$data['AI_HUNYUAN_KEY']??''}" placeholder="请输入模型key" autocomplete="off" class="layui-input">
									<div class="layui-form-mid layui-word-aux">
									    此接口为腾讯混元大模型官方接口，需要输入授权的访问 Key。
									    了解详情，请访问 <a href="https://console.cloud.tencent.com/hunyuan/api-key" target="_blank">【腾讯混元】</a>
									</div>
								</div>
						    </div>
						</div>
						
						<div class="layui-form-item ai-item" id="other" {if condition="$data['AI_AI_NAME'] neq 'other'"} style="display: none;" {/if}>
						</div>
					</div>
						
				</div>
                <div class="layui-input-block" style="min-height: 80px;">
                    <button type="submit" class="pear-btn pear-btn-primary">保存</button>
                    <button type="reset" class="pear-btn">重置</button>
                </div>
        </form>    
        </div>
    </div>
</div>
<script>
	layui.use(['uploads','form','mycomm'], function() {
		let form=layui.form;
		let $ = layui.jquery;
		let mycomm = layui.mycomm;
		
		form.on('radio(filetype)', function(data){
		    if(data.value==1){
		        $("#oss").hide();
		        $("#qiniu").hide();
		    }
		    if(data.value==2){
		        $("#oss").show();
		        $("#qiniu").hide();
		    }
		    if(data.value==3){
		        $("#qiniu").show();
		        $("#oss").hide();
		    }
		});
		 
		 form.on('radio(aitype)', function(data){
		     if(data.value=='glm'){
		         $(".ai-item").hide();
		         $("#glm").show();
		     }else if(data.value=='deepseek'){
		         $(".ai-item").hide();
		         $("#deepseek").show();
			 }else if(data.value=='hunyuan'){
			     $(".ai-item").hide();
			     $("#hunyuan").show();
             }else if(data.value=='siliconflow'){
                 $(".ai-item").hide();
                 $("#siliconflow").show();
		     }else if(data.value=='other'){
		         $(".ai-item").hide();
		         $("#other").show();
		     }
		 });
	});
</script>
{$LOAD_STYLE.bottom|raw}
</body>
</html>
